package com.rui.function.version;

import com.rui.function.Function;
import com.rui.function.IFunctionListener;
import com.rui.net.ITask;
import com.rui.net.http.HttpTask;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import org.json.JSONException;
import org.json.JSONObject;

public class CheckVersionFunction extends Function
{
  public CheckVersionFunction(OnCheckVersionListener paramOnCheckVersionListener)
  {
    super(paramOnCheckVersionListener);
  }

  public void doCehck(String paramString)
  {
    this.task = new HttpTask();
    this.task.execute(30, paramString, this);
  }

  public void onReciveResponse(String paramString, byte[] paramArrayOfByte)
  {
    try
    {
      JSONObject localJSONObject = new JSONObject(new String(paramArrayOfByte, "UTF-8"));
      String str1 = localJSONObject.getString("version");
      String str2 = URLDecoder.decode(localJSONObject.getString("desc"), "GB2312");
      String str3 = localJSONObject.getString("url");
      ((OnCheckVersionListener)this.listener).onVersion(Float.parseFloat(str1), str2, str3);
      return;
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      while (true)
      {
        localUnsupportedEncodingException.printStackTrace();
        this.listener.onException(localUnsupportedEncodingException);
      }
    }
    catch (JSONException localJSONException)
    {
      while (true)
      {
        localJSONException.printStackTrace();
        this.listener.onException(localJSONException);
      }
    }
  }

  public void stop()
  {
    this.task.stopTask();
  }

  public static abstract interface OnCheckVersionListener extends IFunctionListener
  {
    public abstract void onVersion(float paramFloat, String paramString1, String paramString2);
  }
}

/* Location:           F:\temp\tools\classes_dex2jar.jar
 * Qualified Name:     com.rui.function.version.CheckVersionFunction
 * JD-Core Version:    0.6.0
 */